<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "rrhh_postulantesinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$rrhh_postulantes_add = NULL; // Initialize page object first

class crrhh_postulantes_add extends crrhh_postulantes {

	// Page ID
	var $PageID = 'add';

	// Project ID
	var $ProjectID = "{EE79157A-457E-45C2-815F-74BE5B056823}";

	// Table name
	var $TableName = 'rrhh_postulantes';

	// Page object name
	var $PageObjName = 'rrhh_postulantes_add';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (rrhh_postulantes)
		if (!isset($GLOBALS["rrhh_postulantes"]) || get_class($GLOBALS["rrhh_postulantes"]) == "crrhh_postulantes") {
			$GLOBALS["rrhh_postulantes"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["rrhh_postulantes"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'add', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'rrhh_postulantes', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter = "";
	var $DbDetailFilter = "";
	var $Priv = 0;
	var $OldRecordset;
	var $CopyRecord;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Process form if post back
		if (@$_POST["a_add"] <> "") {
			$this->CurrentAction = $_POST["a_add"]; // Get form action
			$this->CopyRecord = $this->LoadOldRecord(); // Load old recordset
			$this->LoadFormValues(); // Load form values
		} else { // Not post back

			// Load key values from QueryString
			$this->CopyRecord = TRUE;
			if (@$_GET["pos_id"] != "") {
				$this->pos_id->setQueryStringValue($_GET["pos_id"]);
				$this->setKey("pos_id", $this->pos_id->CurrentValue); // Set up key
			} else {
				$this->setKey("pos_id", ""); // Clear key
				$this->CopyRecord = FALSE;
			}
			if ($this->CopyRecord) {
				$this->CurrentAction = "C"; // Copy record
			} else {
				$this->CurrentAction = "I"; // Display blank record
				$this->LoadDefaultValues(); // Load default values
			}
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Validate form if post back
		if (@$_POST["a_add"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = "I"; // Form error, reset action
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues(); // Restore form values
				$this->setFailureMessage($gsFormError);
			}
		}

		// Perform action based on action code
		switch ($this->CurrentAction) {
			case "I": // Blank record, no action required
				break;
			case "C": // Copy an existing record
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("rrhh_postulanteslist.php"); // No matching record, return to list
				}
				break;
			case "A": // Add new record
				$this->SendEmail = TRUE; // Send email on add success
				if ($this->AddRow($this->OldRecordset)) { // Add successful
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("AddSuccess")); // Set up success message
					$sReturnUrl = $this->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "rrhh_postulantesview.php")
						$sReturnUrl = $this->GetViewUrl(); // View paging, return to view page with keyurl directly
					$this->Page_Terminate($sReturnUrl); // Clean up and return
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Add failed, restore form values
				}
		}

		// Render row based on row type
		$this->RowType = EW_ROWTYPE_ADD;  // Render add type

		// Render row
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
		$this->pos_cv->Upload->Index = $objForm->Index;
		if ($this->pos_cv->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->pos_cv->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->pos_cv->CurrentValue = $this->pos_cv->Upload->FileName;
	}

	// Load default values
	function LoadDefaultValues() {
		$this->pos_habilitado->CurrentValue = NULL;
		$this->pos_habilitado->OldValue = $this->pos_habilitado->CurrentValue;
		$this->pos_nombre->CurrentValue = NULL;
		$this->pos_nombre->OldValue = $this->pos_nombre->CurrentValue;
		$this->pos_apellido->CurrentValue = NULL;
		$this->pos_apellido->OldValue = $this->pos_apellido->CurrentValue;
		$this->pos_fec_nac->CurrentValue = NULL;
		$this->pos_fec_nac->OldValue = $this->pos_fec_nac->CurrentValue;
		$this->pos_email->CurrentValue = NULL;
		$this->pos_email->OldValue = $this->pos_email->CurrentValue;
		$this->pos_provincia->CurrentValue = NULL;
		$this->pos_provincia->OldValue = $this->pos_provincia->CurrentValue;
		$this->pos_localidad->CurrentValue = NULL;
		$this->pos_localidad->OldValue = $this->pos_localidad->CurrentValue;
		$this->pos_tel_fijo->CurrentValue = NULL;
		$this->pos_tel_fijo->OldValue = $this->pos_tel_fijo->CurrentValue;
		$this->pos_tel_cel->CurrentValue = NULL;
		$this->pos_tel_cel->OldValue = $this->pos_tel_cel->CurrentValue;
		$this->pos_sexo->CurrentValue = NULL;
		$this->pos_sexo->OldValue = $this->pos_sexo->CurrentValue;
		$this->pos_experiencia_profesional->CurrentValue = NULL;
		$this->pos_experiencia_profesional->OldValue = $this->pos_experiencia_profesional->CurrentValue;
		$this->pos_maximo_niv_formacion->CurrentValue = NULL;
		$this->pos_maximo_niv_formacion->OldValue = $this->pos_maximo_niv_formacion->CurrentValue;
		$this->pos_cv->Upload->DbValue = NULL;
		$this->pos_cv->OldValue = $this->pos_cv->Upload->DbValue;
		$this->pos_cv->CurrentValue = NULL; // Clear file related field
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		$this->GetUploadFiles(); // Get upload files
		if (!$this->pos_habilitado->FldIsDetailKey) {
			$this->pos_habilitado->setFormValue($objForm->GetValue("x_pos_habilitado"));
		}
		if (!$this->pos_nombre->FldIsDetailKey) {
			$this->pos_nombre->setFormValue($objForm->GetValue("x_pos_nombre"));
		}
		if (!$this->pos_apellido->FldIsDetailKey) {
			$this->pos_apellido->setFormValue($objForm->GetValue("x_pos_apellido"));
		}
		if (!$this->pos_fec_nac->FldIsDetailKey) {
			$this->pos_fec_nac->setFormValue($objForm->GetValue("x_pos_fec_nac"));
			$this->pos_fec_nac->CurrentValue = ew_UnFormatDateTime($this->pos_fec_nac->CurrentValue, 14);
		}
		if (!$this->pos_email->FldIsDetailKey) {
			$this->pos_email->setFormValue($objForm->GetValue("x_pos_email"));
		}
		if (!$this->pos_provincia->FldIsDetailKey) {
			$this->pos_provincia->setFormValue($objForm->GetValue("x_pos_provincia"));
		}
		if (!$this->pos_localidad->FldIsDetailKey) {
			$this->pos_localidad->setFormValue($objForm->GetValue("x_pos_localidad"));
		}
		if (!$this->pos_tel_fijo->FldIsDetailKey) {
			$this->pos_tel_fijo->setFormValue($objForm->GetValue("x_pos_tel_fijo"));
		}
		if (!$this->pos_tel_cel->FldIsDetailKey) {
			$this->pos_tel_cel->setFormValue($objForm->GetValue("x_pos_tel_cel"));
		}
		if (!$this->pos_sexo->FldIsDetailKey) {
			$this->pos_sexo->setFormValue($objForm->GetValue("x_pos_sexo"));
		}
		if (!$this->pos_experiencia_profesional->FldIsDetailKey) {
			$this->pos_experiencia_profesional->setFormValue($objForm->GetValue("x_pos_experiencia_profesional"));
		}
		if (!$this->pos_maximo_niv_formacion->FldIsDetailKey) {
			$this->pos_maximo_niv_formacion->setFormValue($objForm->GetValue("x_pos_maximo_niv_formacion"));
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadOldRecord();
		$this->pos_habilitado->CurrentValue = $this->pos_habilitado->FormValue;
		$this->pos_nombre->CurrentValue = $this->pos_nombre->FormValue;
		$this->pos_apellido->CurrentValue = $this->pos_apellido->FormValue;
		$this->pos_fec_nac->CurrentValue = $this->pos_fec_nac->FormValue;
		$this->pos_fec_nac->CurrentValue = ew_UnFormatDateTime($this->pos_fec_nac->CurrentValue, 14);
		$this->pos_email->CurrentValue = $this->pos_email->FormValue;
		$this->pos_provincia->CurrentValue = $this->pos_provincia->FormValue;
		$this->pos_localidad->CurrentValue = $this->pos_localidad->FormValue;
		$this->pos_tel_fijo->CurrentValue = $this->pos_tel_fijo->FormValue;
		$this->pos_tel_cel->CurrentValue = $this->pos_tel_cel->FormValue;
		$this->pos_sexo->CurrentValue = $this->pos_sexo->FormValue;
		$this->pos_experiencia_profesional->CurrentValue = $this->pos_experiencia_profesional->FormValue;
		$this->pos_maximo_niv_formacion->CurrentValue = $this->pos_maximo_niv_formacion->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->pos_id->setDbValue($rs->fields('pos_id'));
		$this->pos_habilitado->setDbValue($rs->fields('pos_habilitado'));
		$this->pos_nombre->setDbValue($rs->fields('pos_nombre'));
		$this->pos_apellido->setDbValue($rs->fields('pos_apellido'));
		$this->pos_fec_nac->setDbValue($rs->fields('pos_fec_nac'));
		$this->pos_email->setDbValue($rs->fields('pos_email'));
		$this->pos_provincia->setDbValue($rs->fields('pos_provincia'));
		$this->pos_localidad->setDbValue($rs->fields('pos_localidad'));
		$this->pos_tel_fijo->setDbValue($rs->fields('pos_tel_fijo'));
		$this->pos_tel_cel->setDbValue($rs->fields('pos_tel_cel'));
		$this->pos_sexo->setDbValue($rs->fields('pos_sexo'));
		$this->pos_experiencia_profesional->setDbValue($rs->fields('pos_experiencia_profesional'));
		$this->pos_maximo_niv_formacion->setDbValue($rs->fields('pos_maximo_niv_formacion'));
		$this->pos_cv->Upload->DbValue = $rs->fields('pos_cv');
		$this->pos_cv->CurrentValue = $this->pos_cv->Upload->DbValue;
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->pos_id->DbValue = $row['pos_id'];
		$this->pos_habilitado->DbValue = $row['pos_habilitado'];
		$this->pos_nombre->DbValue = $row['pos_nombre'];
		$this->pos_apellido->DbValue = $row['pos_apellido'];
		$this->pos_fec_nac->DbValue = $row['pos_fec_nac'];
		$this->pos_email->DbValue = $row['pos_email'];
		$this->pos_provincia->DbValue = $row['pos_provincia'];
		$this->pos_localidad->DbValue = $row['pos_localidad'];
		$this->pos_tel_fijo->DbValue = $row['pos_tel_fijo'];
		$this->pos_tel_cel->DbValue = $row['pos_tel_cel'];
		$this->pos_sexo->DbValue = $row['pos_sexo'];
		$this->pos_experiencia_profesional->DbValue = $row['pos_experiencia_profesional'];
		$this->pos_maximo_niv_formacion->DbValue = $row['pos_maximo_niv_formacion'];
		$this->pos_cv->Upload->DbValue = $row['pos_cv'];
	}

	// Load old record
	function LoadOldRecord() {

		// Load key values from Session
		$bValidKey = TRUE;
		if (strval($this->getKey("pos_id")) <> "")
			$this->pos_id->CurrentValue = $this->getKey("pos_id"); // pos_id
		else
			$bValidKey = FALSE;

		// Load old recordset
		if ($bValidKey) {
			$this->CurrentFilter = $this->KeyFilter();
			$sSql = $this->SQL();
			$this->OldRecordset = ew_LoadRecordset($sSql);
			$this->LoadRowValues($this->OldRecordset); // Load row values
		} else {
			$this->OldRecordset = NULL;
		}
		return $bValidKey;
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// pos_id
		// pos_habilitado
		// pos_nombre
		// pos_apellido
		// pos_fec_nac
		// pos_email
		// pos_provincia
		// pos_localidad
		// pos_tel_fijo
		// pos_tel_cel
		// pos_sexo
		// pos_experiencia_profesional
		// pos_maximo_niv_formacion
		// pos_cv

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// pos_id
			$this->pos_id->ViewValue = $this->pos_id->CurrentValue;
			$this->pos_id->ViewCustomAttributes = "";

			// pos_habilitado
			if (strval($this->pos_habilitado->CurrentValue) <> "") {
				switch ($this->pos_habilitado->CurrentValue) {
					case $this->pos_habilitado->FldTagValue(1):
						$this->pos_habilitado->ViewValue = $this->pos_habilitado->FldTagCaption(1) <> "" ? $this->pos_habilitado->FldTagCaption(1) : $this->pos_habilitado->CurrentValue;
						break;
					case $this->pos_habilitado->FldTagValue(2):
						$this->pos_habilitado->ViewValue = $this->pos_habilitado->FldTagCaption(2) <> "" ? $this->pos_habilitado->FldTagCaption(2) : $this->pos_habilitado->CurrentValue;
						break;
					case $this->pos_habilitado->FldTagValue(3):
						$this->pos_habilitado->ViewValue = $this->pos_habilitado->FldTagCaption(3) <> "" ? $this->pos_habilitado->FldTagCaption(3) : $this->pos_habilitado->CurrentValue;
						break;
					default:
						$this->pos_habilitado->ViewValue = $this->pos_habilitado->CurrentValue;
				}
			} else {
				$this->pos_habilitado->ViewValue = NULL;
			}
			$this->pos_habilitado->ViewCustomAttributes = "";

			// pos_nombre
			$this->pos_nombre->ViewValue = $this->pos_nombre->CurrentValue;
			$this->pos_nombre->ViewCustomAttributes = "";

			// pos_apellido
			$this->pos_apellido->ViewValue = $this->pos_apellido->CurrentValue;
			$this->pos_apellido->ViewCustomAttributes = "";

			// pos_fec_nac
			$this->pos_fec_nac->ViewValue = $this->pos_fec_nac->CurrentValue;
			$this->pos_fec_nac->ViewValue = ew_FormatDateTime($this->pos_fec_nac->ViewValue, 14);
			$this->pos_fec_nac->ViewCustomAttributes = "";

			// pos_email
			$this->pos_email->ViewValue = $this->pos_email->CurrentValue;
			$this->pos_email->ViewCustomAttributes = "";

			// pos_provincia
			if (strval($this->pos_provincia->CurrentValue) <> "") {
				$sFilterWrk = "`pro_id`" . ew_SearchString("=", $this->pos_provincia->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `pro_id`, `pro_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `rrhh_provincia`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->pos_provincia, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->pos_provincia->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->pos_provincia->ViewValue = $this->pos_provincia->CurrentValue;
				}
			} else {
				$this->pos_provincia->ViewValue = NULL;
			}
			$this->pos_provincia->ViewCustomAttributes = "";

			// pos_localidad
			$this->pos_localidad->ViewValue = $this->pos_localidad->CurrentValue;
			if (strval($this->pos_localidad->CurrentValue) <> "") {
				$sFilterWrk = "`loc_id`" . ew_SearchString("=", $this->pos_localidad->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `loc_id`, `loc_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `rrhh_localidad`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->pos_localidad, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->pos_localidad->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->pos_localidad->ViewValue = $this->pos_localidad->CurrentValue;
				}
			} else {
				$this->pos_localidad->ViewValue = NULL;
			}
			$this->pos_localidad->ViewCustomAttributes = "";

			// pos_tel_fijo
			$this->pos_tel_fijo->ViewValue = $this->pos_tel_fijo->CurrentValue;
			$this->pos_tel_fijo->ViewCustomAttributes = "";

			// pos_tel_cel
			$this->pos_tel_cel->ViewValue = $this->pos_tel_cel->CurrentValue;
			$this->pos_tel_cel->ViewCustomAttributes = "";

			// pos_sexo
			if (strval($this->pos_sexo->CurrentValue) <> "") {
				switch ($this->pos_sexo->CurrentValue) {
					case $this->pos_sexo->FldTagValue(1):
						$this->pos_sexo->ViewValue = $this->pos_sexo->FldTagCaption(1) <> "" ? $this->pos_sexo->FldTagCaption(1) : $this->pos_sexo->CurrentValue;
						break;
					case $this->pos_sexo->FldTagValue(2):
						$this->pos_sexo->ViewValue = $this->pos_sexo->FldTagCaption(2) <> "" ? $this->pos_sexo->FldTagCaption(2) : $this->pos_sexo->CurrentValue;
						break;
					default:
						$this->pos_sexo->ViewValue = $this->pos_sexo->CurrentValue;
				}
			} else {
				$this->pos_sexo->ViewValue = NULL;
			}
			$this->pos_sexo->ViewCustomAttributes = "";

			// pos_experiencia_profesional
			if (strval($this->pos_experiencia_profesional->CurrentValue) <> "") {
				switch ($this->pos_experiencia_profesional->CurrentValue) {
					case $this->pos_experiencia_profesional->FldTagValue(1):
						$this->pos_experiencia_profesional->ViewValue = $this->pos_experiencia_profesional->FldTagCaption(1) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(1) : $this->pos_experiencia_profesional->CurrentValue;
						break;
					case $this->pos_experiencia_profesional->FldTagValue(2):
						$this->pos_experiencia_profesional->ViewValue = $this->pos_experiencia_profesional->FldTagCaption(2) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(2) : $this->pos_experiencia_profesional->CurrentValue;
						break;
					case $this->pos_experiencia_profesional->FldTagValue(3):
						$this->pos_experiencia_profesional->ViewValue = $this->pos_experiencia_profesional->FldTagCaption(3) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(3) : $this->pos_experiencia_profesional->CurrentValue;
						break;
					case $this->pos_experiencia_profesional->FldTagValue(4):
						$this->pos_experiencia_profesional->ViewValue = $this->pos_experiencia_profesional->FldTagCaption(4) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(4) : $this->pos_experiencia_profesional->CurrentValue;
						break;
					default:
						$this->pos_experiencia_profesional->ViewValue = $this->pos_experiencia_profesional->CurrentValue;
				}
			} else {
				$this->pos_experiencia_profesional->ViewValue = NULL;
			}
			$this->pos_experiencia_profesional->ViewCustomAttributes = "";

			// pos_maximo_niv_formacion
			if (strval($this->pos_maximo_niv_formacion->CurrentValue) <> "") {
				switch ($this->pos_maximo_niv_formacion->CurrentValue) {
					case $this->pos_maximo_niv_formacion->FldTagValue(1):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(1) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(1) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(2):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(2) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(2) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(3):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(3) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(3) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(4):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(4) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(4) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(5):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(5) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(5) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(6):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(6) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(6) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(7):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(7) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(7) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					case $this->pos_maximo_niv_formacion->FldTagValue(8):
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->FldTagCaption(8) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(8) : $this->pos_maximo_niv_formacion->CurrentValue;
						break;
					default:
						$this->pos_maximo_niv_formacion->ViewValue = $this->pos_maximo_niv_formacion->CurrentValue;
				}
			} else {
				$this->pos_maximo_niv_formacion->ViewValue = NULL;
			}
			$this->pos_maximo_niv_formacion->ViewCustomAttributes = "";

			// pos_cv
			if (!ew_Empty($this->pos_cv->Upload->DbValue)) {
				$this->pos_cv->ViewValue = $this->pos_cv->Upload->DbValue;
			} else {
				$this->pos_cv->ViewValue = "";
			}
			$this->pos_cv->ViewCustomAttributes = "";

			// pos_habilitado
			$this->pos_habilitado->LinkCustomAttributes = "";
			$this->pos_habilitado->HrefValue = "";
			$this->pos_habilitado->TooltipValue = "";

			// pos_nombre
			$this->pos_nombre->LinkCustomAttributes = "";
			$this->pos_nombre->HrefValue = "";
			$this->pos_nombre->TooltipValue = "";

			// pos_apellido
			$this->pos_apellido->LinkCustomAttributes = "";
			$this->pos_apellido->HrefValue = "";
			$this->pos_apellido->TooltipValue = "";

			// pos_fec_nac
			$this->pos_fec_nac->LinkCustomAttributes = "";
			$this->pos_fec_nac->HrefValue = "";
			$this->pos_fec_nac->TooltipValue = "";

			// pos_email
			$this->pos_email->LinkCustomAttributes = "";
			$this->pos_email->HrefValue = "";
			$this->pos_email->TooltipValue = "";

			// pos_provincia
			$this->pos_provincia->LinkCustomAttributes = "";
			$this->pos_provincia->HrefValue = "";
			$this->pos_provincia->TooltipValue = "";

			// pos_localidad
			$this->pos_localidad->LinkCustomAttributes = "";
			$this->pos_localidad->HrefValue = "";
			$this->pos_localidad->TooltipValue = "";

			// pos_tel_fijo
			$this->pos_tel_fijo->LinkCustomAttributes = "";
			$this->pos_tel_fijo->HrefValue = "";
			$this->pos_tel_fijo->TooltipValue = "";

			// pos_tel_cel
			$this->pos_tel_cel->LinkCustomAttributes = "";
			$this->pos_tel_cel->HrefValue = "";
			$this->pos_tel_cel->TooltipValue = "";

			// pos_sexo
			$this->pos_sexo->LinkCustomAttributes = "";
			$this->pos_sexo->HrefValue = "";
			$this->pos_sexo->TooltipValue = "";

			// pos_experiencia_profesional
			$this->pos_experiencia_profesional->LinkCustomAttributes = "";
			$this->pos_experiencia_profesional->HrefValue = "";
			$this->pos_experiencia_profesional->TooltipValue = "";

			// pos_maximo_niv_formacion
			$this->pos_maximo_niv_formacion->LinkCustomAttributes = "";
			$this->pos_maximo_niv_formacion->HrefValue = "";
			$this->pos_maximo_niv_formacion->TooltipValue = "";

			// pos_cv
			$this->pos_cv->LinkCustomAttributes = "";
			$this->pos_cv->HrefValue = "";
			$this->pos_cv->HrefValue2 = $this->pos_cv->UploadPath . $this->pos_cv->Upload->DbValue;
			$this->pos_cv->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_ADD) { // Add row

			// pos_habilitado
			$this->pos_habilitado->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->pos_habilitado->FldTagValue(1), $this->pos_habilitado->FldTagCaption(1) <> "" ? $this->pos_habilitado->FldTagCaption(1) : $this->pos_habilitado->FldTagValue(1));
			$arwrk[] = array($this->pos_habilitado->FldTagValue(2), $this->pos_habilitado->FldTagCaption(2) <> "" ? $this->pos_habilitado->FldTagCaption(2) : $this->pos_habilitado->FldTagValue(2));
			$arwrk[] = array($this->pos_habilitado->FldTagValue(3), $this->pos_habilitado->FldTagCaption(3) <> "" ? $this->pos_habilitado->FldTagCaption(3) : $this->pos_habilitado->FldTagValue(3));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->pos_habilitado->EditValue = $arwrk;

			// pos_nombre
			$this->pos_nombre->EditCustomAttributes = "";
			$this->pos_nombre->EditValue = ew_HtmlEncode($this->pos_nombre->CurrentValue);
			$this->pos_nombre->PlaceHolder = ew_RemoveHtml($this->pos_nombre->FldCaption());

			// pos_apellido
			$this->pos_apellido->EditCustomAttributes = "";
			$this->pos_apellido->EditValue = ew_HtmlEncode($this->pos_apellido->CurrentValue);
			$this->pos_apellido->PlaceHolder = ew_RemoveHtml($this->pos_apellido->FldCaption());

			// pos_fec_nac
			$this->pos_fec_nac->EditCustomAttributes = "";
			$this->pos_fec_nac->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->pos_fec_nac->CurrentValue, 14));
			$this->pos_fec_nac->PlaceHolder = ew_RemoveHtml($this->pos_fec_nac->FldCaption());

			// pos_email
			$this->pos_email->EditCustomAttributes = "";
			$this->pos_email->EditValue = ew_HtmlEncode($this->pos_email->CurrentValue);
			$this->pos_email->PlaceHolder = ew_RemoveHtml($this->pos_email->FldCaption());

			// pos_provincia
			$this->pos_provincia->EditCustomAttributes = "";
			if (trim(strval($this->pos_provincia->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`pro_id`" . ew_SearchString("=", $this->pos_provincia->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `pro_id`, `pro_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `rrhh_provincia`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->pos_provincia, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->pos_provincia->EditValue = $arwrk;

			// pos_localidad
			$this->pos_localidad->EditCustomAttributes = "";
			$this->pos_localidad->EditValue = ew_HtmlEncode($this->pos_localidad->CurrentValue);
			if (strval($this->pos_localidad->CurrentValue) <> "") {
				$sFilterWrk = "`loc_id`" . ew_SearchString("=", $this->pos_localidad->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `loc_id`, `loc_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `rrhh_localidad`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->pos_localidad, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->pos_localidad->EditValue = ew_HtmlEncode($rswrk->fields('DispFld'));
					$rswrk->Close();
				} else {
					$this->pos_localidad->EditValue = ew_HtmlEncode($this->pos_localidad->CurrentValue);
				}
			} else {
				$this->pos_localidad->EditValue = NULL;
			}
			$this->pos_localidad->PlaceHolder = ew_RemoveHtml($this->pos_localidad->FldCaption());

			// pos_tel_fijo
			$this->pos_tel_fijo->EditCustomAttributes = "";
			$this->pos_tel_fijo->EditValue = ew_HtmlEncode($this->pos_tel_fijo->CurrentValue);
			$this->pos_tel_fijo->PlaceHolder = ew_RemoveHtml($this->pos_tel_fijo->FldCaption());

			// pos_tel_cel
			$this->pos_tel_cel->EditCustomAttributes = "";
			$this->pos_tel_cel->EditValue = ew_HtmlEncode($this->pos_tel_cel->CurrentValue);
			$this->pos_tel_cel->PlaceHolder = ew_RemoveHtml($this->pos_tel_cel->FldCaption());

			// pos_sexo
			$this->pos_sexo->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->pos_sexo->FldTagValue(1), $this->pos_sexo->FldTagCaption(1) <> "" ? $this->pos_sexo->FldTagCaption(1) : $this->pos_sexo->FldTagValue(1));
			$arwrk[] = array($this->pos_sexo->FldTagValue(2), $this->pos_sexo->FldTagCaption(2) <> "" ? $this->pos_sexo->FldTagCaption(2) : $this->pos_sexo->FldTagValue(2));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->pos_sexo->EditValue = $arwrk;

			// pos_experiencia_profesional
			$this->pos_experiencia_profesional->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->pos_experiencia_profesional->FldTagValue(1), $this->pos_experiencia_profesional->FldTagCaption(1) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(1) : $this->pos_experiencia_profesional->FldTagValue(1));
			$arwrk[] = array($this->pos_experiencia_profesional->FldTagValue(2), $this->pos_experiencia_profesional->FldTagCaption(2) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(2) : $this->pos_experiencia_profesional->FldTagValue(2));
			$arwrk[] = array($this->pos_experiencia_profesional->FldTagValue(3), $this->pos_experiencia_profesional->FldTagCaption(3) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(3) : $this->pos_experiencia_profesional->FldTagValue(3));
			$arwrk[] = array($this->pos_experiencia_profesional->FldTagValue(4), $this->pos_experiencia_profesional->FldTagCaption(4) <> "" ? $this->pos_experiencia_profesional->FldTagCaption(4) : $this->pos_experiencia_profesional->FldTagValue(4));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->pos_experiencia_profesional->EditValue = $arwrk;

			// pos_maximo_niv_formacion
			$this->pos_maximo_niv_formacion->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(1), $this->pos_maximo_niv_formacion->FldTagCaption(1) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(1) : $this->pos_maximo_niv_formacion->FldTagValue(1));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(2), $this->pos_maximo_niv_formacion->FldTagCaption(2) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(2) : $this->pos_maximo_niv_formacion->FldTagValue(2));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(3), $this->pos_maximo_niv_formacion->FldTagCaption(3) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(3) : $this->pos_maximo_niv_formacion->FldTagValue(3));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(4), $this->pos_maximo_niv_formacion->FldTagCaption(4) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(4) : $this->pos_maximo_niv_formacion->FldTagValue(4));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(5), $this->pos_maximo_niv_formacion->FldTagCaption(5) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(5) : $this->pos_maximo_niv_formacion->FldTagValue(5));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(6), $this->pos_maximo_niv_formacion->FldTagCaption(6) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(6) : $this->pos_maximo_niv_formacion->FldTagValue(6));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(7), $this->pos_maximo_niv_formacion->FldTagCaption(7) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(7) : $this->pos_maximo_niv_formacion->FldTagValue(7));
			$arwrk[] = array($this->pos_maximo_niv_formacion->FldTagValue(8), $this->pos_maximo_niv_formacion->FldTagCaption(8) <> "" ? $this->pos_maximo_niv_formacion->FldTagCaption(8) : $this->pos_maximo_niv_formacion->FldTagValue(8));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->pos_maximo_niv_formacion->EditValue = $arwrk;

			// pos_cv
			$this->pos_cv->EditCustomAttributes = "";
			if (!ew_Empty($this->pos_cv->Upload->DbValue)) {
				$this->pos_cv->EditValue = $this->pos_cv->Upload->DbValue;
			} else {
				$this->pos_cv->EditValue = "";
			}
			if (!ew_Empty($this->pos_cv->CurrentValue))
				$this->pos_cv->Upload->FileName = $this->pos_cv->CurrentValue;
			if (($this->CurrentAction == "I" || $this->CurrentAction == "C") && !$this->EventCancelled) ew_RenderUploadField($this->pos_cv);

			// Edit refer script
			// pos_habilitado

			$this->pos_habilitado->HrefValue = "";

			// pos_nombre
			$this->pos_nombre->HrefValue = "";

			// pos_apellido
			$this->pos_apellido->HrefValue = "";

			// pos_fec_nac
			$this->pos_fec_nac->HrefValue = "";

			// pos_email
			$this->pos_email->HrefValue = "";

			// pos_provincia
			$this->pos_provincia->HrefValue = "";

			// pos_localidad
			$this->pos_localidad->HrefValue = "";

			// pos_tel_fijo
			$this->pos_tel_fijo->HrefValue = "";

			// pos_tel_cel
			$this->pos_tel_cel->HrefValue = "";

			// pos_sexo
			$this->pos_sexo->HrefValue = "";

			// pos_experiencia_profesional
			$this->pos_experiencia_profesional->HrefValue = "";

			// pos_maximo_niv_formacion
			$this->pos_maximo_niv_formacion->HrefValue = "";

			// pos_cv
			$this->pos_cv->HrefValue = "";
			$this->pos_cv->HrefValue2 = $this->pos_cv->UploadPath . $this->pos_cv->Upload->DbValue;
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!$this->pos_habilitado->FldIsDetailKey && !is_null($this->pos_habilitado->FormValue) && $this->pos_habilitado->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_habilitado->FldCaption());
		}
		if (!ew_CheckShortEuroDate($this->pos_fec_nac->FormValue)) {
			ew_AddMessage($gsFormError, $this->pos_fec_nac->FldErrMsg());
		}
		if (!ew_CheckInteger($this->pos_localidad->FormValue)) {
			ew_AddMessage($gsFormError, $this->pos_localidad->FldErrMsg());
		}
		if (!$this->pos_tel_fijo->FldIsDetailKey && !is_null($this->pos_tel_fijo->FormValue) && $this->pos_tel_fijo->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_tel_fijo->FldCaption());
		}
		if (!$this->pos_tel_cel->FldIsDetailKey && !is_null($this->pos_tel_cel->FormValue) && $this->pos_tel_cel->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_tel_cel->FldCaption());
		}
		if (!$this->pos_sexo->FldIsDetailKey && !is_null($this->pos_sexo->FormValue) && $this->pos_sexo->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_sexo->FldCaption());
		}
		if (!$this->pos_experiencia_profesional->FldIsDetailKey && !is_null($this->pos_experiencia_profesional->FormValue) && $this->pos_experiencia_profesional->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_experiencia_profesional->FldCaption());
		}
		if (!$this->pos_maximo_niv_formacion->FldIsDetailKey && !is_null($this->pos_maximo_niv_formacion->FormValue) && $this->pos_maximo_niv_formacion->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_maximo_niv_formacion->FldCaption());
		}
		if (is_null($this->pos_cv->Upload->Value) && !$this->pos_cv->Upload->KeepFile) {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->pos_cv->FldCaption());
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Add record
	function AddRow($rsold = NULL) {
		global $conn, $Language, $Security;

		// Load db values from rsold
		if ($rsold) {
			$this->LoadDbValues($rsold);
		}
		$rsnew = array();

		// pos_habilitado
		$this->pos_habilitado->SetDbValueDef($rsnew, $this->pos_habilitado->CurrentValue, 0, FALSE);

		// pos_nombre
		$this->pos_nombre->SetDbValueDef($rsnew, $this->pos_nombre->CurrentValue, NULL, FALSE);

		// pos_apellido
		$this->pos_apellido->SetDbValueDef($rsnew, $this->pos_apellido->CurrentValue, NULL, FALSE);

		// pos_fec_nac
		$this->pos_fec_nac->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->pos_fec_nac->CurrentValue, 14), NULL, FALSE);

		// pos_email
		$this->pos_email->SetDbValueDef($rsnew, $this->pos_email->CurrentValue, NULL, FALSE);

		// pos_provincia
		$this->pos_provincia->SetDbValueDef($rsnew, $this->pos_provincia->CurrentValue, NULL, FALSE);

		// pos_localidad
		$this->pos_localidad->SetDbValueDef($rsnew, $this->pos_localidad->CurrentValue, NULL, FALSE);

		// pos_tel_fijo
		$this->pos_tel_fijo->SetDbValueDef($rsnew, $this->pos_tel_fijo->CurrentValue, "", FALSE);

		// pos_tel_cel
		$this->pos_tel_cel->SetDbValueDef($rsnew, $this->pos_tel_cel->CurrentValue, "", FALSE);

		// pos_sexo
		$this->pos_sexo->SetDbValueDef($rsnew, $this->pos_sexo->CurrentValue, "", FALSE);

		// pos_experiencia_profesional
		$this->pos_experiencia_profesional->SetDbValueDef($rsnew, $this->pos_experiencia_profesional->CurrentValue, 0, FALSE);

		// pos_maximo_niv_formacion
		$this->pos_maximo_niv_formacion->SetDbValueDef($rsnew, $this->pos_maximo_niv_formacion->CurrentValue, 0, FALSE);

		// pos_cv
		if (!$this->pos_cv->Upload->KeepFile) {
			if ($this->pos_cv->Upload->FileName == "") {
				$rsnew['pos_cv'] = NULL;
			} else {
				$rsnew['pos_cv'] = $this->pos_cv->Upload->FileName;
			}
		}
		if (!$this->pos_cv->Upload->KeepFile) {
			if (!ew_Empty($this->pos_cv->Upload->Value)) {
				$rsnew['pos_cv'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->pos_cv->UploadPath), $rsnew['pos_cv']); // Get new file name
			}
		}

		// Call Row Inserting event
		$rs = ($rsold == NULL) ? NULL : $rsold->fields;
		$bInsertRow = $this->Row_Inserting($rs, $rsnew);
		if ($bInsertRow) {
			$conn->raiseErrorFn = 'ew_ErrorFn';
			$AddRow = $this->Insert($rsnew);
			$conn->raiseErrorFn = '';
			if ($AddRow) {
				if (!$this->pos_cv->Upload->KeepFile) {
					if (!ew_Empty($this->pos_cv->Upload->Value)) {
						$this->pos_cv->Upload->SaveToFile($this->pos_cv->UploadPath, $rsnew['pos_cv'], TRUE);
					}
				}
			}
		} else {
			if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

				// Use the message, do nothing
			} elseif ($this->CancelMessage <> "") {
				$this->setFailureMessage($this->CancelMessage);
				$this->CancelMessage = "";
			} else {
				$this->setFailureMessage($Language->Phrase("InsertCancelled"));
			}
			$AddRow = FALSE;
		}

		// Get insert id if necessary
		if ($AddRow) {
			$this->pos_id->setDbValue($conn->Insert_ID());
			$rsnew['pos_id'] = $this->pos_id->DbValue;
		}
		if ($AddRow) {

			// Call Row Inserted event
			$rs = ($rsold == NULL) ? NULL : $rsold->fields;
			$this->Row_Inserted($rs, $rsnew);
		}

		// pos_cv
		ew_CleanUploadTempPath($this->pos_cv, $this->pos_cv->Upload->Index);
		return $AddRow;
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "rrhh_postulanteslist.php", $this->TableVar, TRUE);
		$PageId = ($this->CurrentAction == "C") ? "Copy" : "Add";
		$Breadcrumb->Add("add", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($rrhh_postulantes_add)) $rrhh_postulantes_add = new crrhh_postulantes_add();

// Page init
$rrhh_postulantes_add->Page_Init();

// Page main
$rrhh_postulantes_add->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$rrhh_postulantes_add->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var rrhh_postulantes_add = new ew_Page("rrhh_postulantes_add");
rrhh_postulantes_add.PageID = "add"; // Page ID
var EW_PAGE_ID = rrhh_postulantes_add.PageID; // For backward compatibility

// Form object
var frrhh_postulantesadd = new ew_Form("frrhh_postulantesadd");

// Validate form
frrhh_postulantesadd.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_pos_habilitado");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_habilitado->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_pos_fec_nac");
			if (elm && !ew_CheckShortEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_postulantes->pos_fec_nac->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_pos_localidad");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($rrhh_postulantes->pos_localidad->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_pos_tel_fijo");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_tel_fijo->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_pos_tel_cel");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_tel_cel->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_pos_sexo");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_sexo->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_pos_experiencia_profesional");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_experiencia_profesional->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_pos_maximo_niv_formacion");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_maximo_niv_formacion->FldCaption()) ?>");
			felm = this.GetElements("x" + infix + "_pos_cv");
			elm = this.GetElements("fn_x" + infix + "_pos_cv");
			if (felm && elm && !ew_HasValue(elm))
				return this.OnError(felm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($rrhh_postulantes->pos_cv->FldCaption()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
frrhh_postulantesadd.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
frrhh_postulantesadd.ValidateRequired = true;
<?php } else { ?>
frrhh_postulantesadd.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
frrhh_postulantesadd.Lists["x_pos_provincia"] = {"LinkField":"x_pro_id","Ajax":true,"AutoFill":false,"DisplayFields":["x_pro_nombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
frrhh_postulantesadd.Lists["x_pos_localidad"] = {"LinkField":"x_loc_id","Ajax":true,"AutoFill":false,"DisplayFields":["x_loc_nombre","","",""],"ParentFields":["x_pos_provincia"],"FilterFields":["x_loc_provincia"],"Options":[]};

// Form object for search
</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $rrhh_postulantes_add->ShowPageHeader(); ?>
<?php
$rrhh_postulantes_add->ShowMessage();
?>
<form name="frrhh_postulantesadd" id="frrhh_postulantesadd" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="rrhh_postulantes">
<input type="hidden" name="a_add" id="a_add" value="A">
<table class="ewGrid"><tr><td>
<table id="tbl_rrhh_postulantesadd" class="table table-bordered table-striped">
<?php if ($rrhh_postulantes->pos_habilitado->Visible) { // pos_habilitado ?>
	<tr id="r_pos_habilitado">
		<td><span id="elh_rrhh_postulantes_pos_habilitado"><?php echo $rrhh_postulantes->pos_habilitado->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_habilitado->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_habilitado" class="control-group">
<select data-field="x_pos_habilitado" id="x_pos_habilitado" name="x_pos_habilitado"<?php echo $rrhh_postulantes->pos_habilitado->EditAttributes() ?>>
<?php
if (is_array($rrhh_postulantes->pos_habilitado->EditValue)) {
	$arwrk = $rrhh_postulantes->pos_habilitado->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_postulantes->pos_habilitado->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $rrhh_postulantes->pos_habilitado->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_nombre->Visible) { // pos_nombre ?>
	<tr id="r_pos_nombre">
		<td><span id="elh_rrhh_postulantes_pos_nombre"><?php echo $rrhh_postulantes->pos_nombre->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_nombre->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_nombre" class="control-group">
<input type="text" data-field="x_pos_nombre" name="x_pos_nombre" id="x_pos_nombre" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_nombre->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_nombre->EditValue ?>"<?php echo $rrhh_postulantes->pos_nombre->EditAttributes() ?>>
</span>
<?php echo $rrhh_postulantes->pos_nombre->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_apellido->Visible) { // pos_apellido ?>
	<tr id="r_pos_apellido">
		<td><span id="elh_rrhh_postulantes_pos_apellido"><?php echo $rrhh_postulantes->pos_apellido->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_apellido->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_apellido" class="control-group">
<input type="text" data-field="x_pos_apellido" name="x_pos_apellido" id="x_pos_apellido" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_apellido->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_apellido->EditValue ?>"<?php echo $rrhh_postulantes->pos_apellido->EditAttributes() ?>>
</span>
<?php echo $rrhh_postulantes->pos_apellido->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_fec_nac->Visible) { // pos_fec_nac ?>
	<tr id="r_pos_fec_nac">
		<td><span id="elh_rrhh_postulantes_pos_fec_nac"><?php echo $rrhh_postulantes->pos_fec_nac->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_fec_nac->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_fec_nac" class="control-group">
<input type="text" data-field="x_pos_fec_nac" name="x_pos_fec_nac" id="x_pos_fec_nac" size="11" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_fec_nac->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_fec_nac->EditValue ?>"<?php echo $rrhh_postulantes->pos_fec_nac->EditAttributes() ?>>
<?php if (!$rrhh_postulantes->pos_fec_nac->ReadOnly && !$rrhh_postulantes->pos_fec_nac->Disabled && @$rrhh_postulantes->pos_fec_nac->EditAttrs["readonly"] == "" && @$rrhh_postulantes->pos_fec_nac->EditAttrs["disabled"] == "") { ?>
<button id="cal_x_pos_fec_nac" name="cal_x_pos_fec_nac" class="btn" type="button"><img src="phpimages/calendar.png" alt="<?php echo $Language->Phrase("PickDate") ?>" title="<?php echo $Language->Phrase("PickDate") ?>" style="border: 0;"></button><script type="text/javascript">
ew_CreateCalendar("frrhh_postulantesadd", "x_pos_fec_nac", "%d/%m/%y");
</script>
<?php } ?>
</span>
<?php echo $rrhh_postulantes->pos_fec_nac->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_email->Visible) { // pos_email ?>
	<tr id="r_pos_email">
		<td><span id="elh_rrhh_postulantes_pos_email"><?php echo $rrhh_postulantes->pos_email->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_email->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_email" class="control-group">
<input type="text" data-field="x_pos_email" name="x_pos_email" id="x_pos_email" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_email->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_email->EditValue ?>"<?php echo $rrhh_postulantes->pos_email->EditAttributes() ?>>
</span>
<?php echo $rrhh_postulantes->pos_email->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_provincia->Visible) { // pos_provincia ?>
	<tr id="r_pos_provincia">
		<td><span id="elh_rrhh_postulantes_pos_provincia"><?php echo $rrhh_postulantes->pos_provincia->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_provincia->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_provincia" class="control-group">
<?php $rrhh_postulantes->pos_provincia->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_pos_localidad']); " . @$rrhh_postulantes->pos_provincia->EditAttrs["onchange"]; ?>
<select data-field="x_pos_provincia" id="x_pos_provincia" name="x_pos_provincia"<?php echo $rrhh_postulantes->pos_provincia->EditAttributes() ?>>
<?php
if (is_array($rrhh_postulantes->pos_provincia->EditValue)) {
	$arwrk = $rrhh_postulantes->pos_provincia->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_postulantes->pos_provincia->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `pro_id`, `pro_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `rrhh_provincia`";
$sWhereWrk = "";

// Call Lookup selecting
$rrhh_postulantes->Lookup_Selecting($rrhh_postulantes->pos_provincia, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_pos_provincia" id="s_x_pos_provincia" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`pro_id` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $rrhh_postulantes->pos_provincia->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_localidad->Visible) { // pos_localidad ?>
	<tr id="r_pos_localidad">
		<td><span id="elh_rrhh_postulantes_pos_localidad"><?php echo $rrhh_postulantes->pos_localidad->FldCaption() ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_localidad->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_localidad" class="control-group">
<?php
	$wrkonchange = trim(" " . @$rrhh_postulantes->pos_localidad->EditAttrs["onchange"]);
	if ($wrkonchange <> "") $wrkonchange = " onchange=\"" . ew_JsEncode2($wrkonchange) . "\"";
	$rrhh_postulantes->pos_localidad->EditAttrs["onchange"] = "";
?>
<span id="as_x_pos_localidad" style="white-space: nowrap; z-index: 8920">
	<input type="text" name="sv_x_pos_localidad" id="sv_x_pos_localidad" value="<?php echo $rrhh_postulantes->pos_localidad->EditValue ?>" size="30" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_localidad->PlaceHolder) ?>"<?php echo $rrhh_postulantes->pos_localidad->EditAttributes() ?>>&nbsp;<span id="em_x_pos_localidad" class="ewMessage" style="display: none"><?php echo str_replace("%f", "phpimages/", $Language->Phrase("UnmatchedValue")) ?></span>
	<div id="sc_x_pos_localidad" style="display: inline; z-index: 8920"></div>
</span>
<input type="hidden" data-field="x_pos_localidad" name="x_pos_localidad" id="x_pos_localidad" value="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_localidad->CurrentValue) ?>"<?php echo $wrkonchange ?>>
<?php
$sSqlWrk = "SELECT `loc_id`, `loc_nombre` AS `DispFld` FROM `rrhh_localidad`";
$sWhereWrk = "(`loc_nombre` LIKE '{query_value}%') AND ({filter})";

// Call Lookup selecting
$rrhh_postulantes->Lookup_Selecting($rrhh_postulantes->pos_localidad, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " LIMIT " . EW_AUTO_SUGGEST_MAX_ENTRIES;
?>
<input type="hidden" name="q_x_pos_localidad" id="q_x_pos_localidad" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&f1=<?php echo ew_Encrypt("`loc_provincia` IN ({filter_value})"); ?>&t1=3">
<script type="text/javascript">
var oas = new ew_AutoSuggest("x_pos_localidad", frrhh_postulantesadd, true, EW_AUTO_SUGGEST_MAX_ENTRIES);
oas.formatResult = function(ar) {
	var dv = ar[1];
	for (var i = 2; i <= 4; i++)
		dv += (ar[i]) ? ew_ValueSeparator(i - 1, "x_pos_localidad") + ar[i] : "";
	return dv;
}
frrhh_postulantesadd.AutoSuggests["x_pos_localidad"] = oas;
</script>
</span>
<?php echo $rrhh_postulantes->pos_localidad->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_tel_fijo->Visible) { // pos_tel_fijo ?>
	<tr id="r_pos_tel_fijo">
		<td><span id="elh_rrhh_postulantes_pos_tel_fijo"><?php echo $rrhh_postulantes->pos_tel_fijo->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_tel_fijo->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_tel_fijo" class="control-group">
<input type="text" data-field="x_pos_tel_fijo" name="x_pos_tel_fijo" id="x_pos_tel_fijo" size="30" maxlength="15" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_tel_fijo->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_tel_fijo->EditValue ?>"<?php echo $rrhh_postulantes->pos_tel_fijo->EditAttributes() ?>>
</span>
<?php echo $rrhh_postulantes->pos_tel_fijo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_tel_cel->Visible) { // pos_tel_cel ?>
	<tr id="r_pos_tel_cel">
		<td><span id="elh_rrhh_postulantes_pos_tel_cel"><?php echo $rrhh_postulantes->pos_tel_cel->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_tel_cel->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_tel_cel" class="control-group">
<input type="text" data-field="x_pos_tel_cel" name="x_pos_tel_cel" id="x_pos_tel_cel" size="30" maxlength="15" placeholder="<?php echo ew_HtmlEncode($rrhh_postulantes->pos_tel_cel->PlaceHolder) ?>" value="<?php echo $rrhh_postulantes->pos_tel_cel->EditValue ?>"<?php echo $rrhh_postulantes->pos_tel_cel->EditAttributes() ?>>
</span>
<?php echo $rrhh_postulantes->pos_tel_cel->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_sexo->Visible) { // pos_sexo ?>
	<tr id="r_pos_sexo">
		<td><span id="elh_rrhh_postulantes_pos_sexo"><?php echo $rrhh_postulantes->pos_sexo->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_sexo->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_sexo" class="control-group">
<select data-field="x_pos_sexo" id="x_pos_sexo" name="x_pos_sexo"<?php echo $rrhh_postulantes->pos_sexo->EditAttributes() ?>>
<?php
if (is_array($rrhh_postulantes->pos_sexo->EditValue)) {
	$arwrk = $rrhh_postulantes->pos_sexo->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_postulantes->pos_sexo->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $rrhh_postulantes->pos_sexo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_experiencia_profesional->Visible) { // pos_experiencia_profesional ?>
	<tr id="r_pos_experiencia_profesional">
		<td><span id="elh_rrhh_postulantes_pos_experiencia_profesional"><?php echo $rrhh_postulantes->pos_experiencia_profesional->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_experiencia_profesional->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_experiencia_profesional" class="control-group">
<select data-field="x_pos_experiencia_profesional" id="x_pos_experiencia_profesional" name="x_pos_experiencia_profesional"<?php echo $rrhh_postulantes->pos_experiencia_profesional->EditAttributes() ?>>
<?php
if (is_array($rrhh_postulantes->pos_experiencia_profesional->EditValue)) {
	$arwrk = $rrhh_postulantes->pos_experiencia_profesional->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_postulantes->pos_experiencia_profesional->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $rrhh_postulantes->pos_experiencia_profesional->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_maximo_niv_formacion->Visible) { // pos_maximo_niv_formacion ?>
	<tr id="r_pos_maximo_niv_formacion">
		<td><span id="elh_rrhh_postulantes_pos_maximo_niv_formacion"><?php echo $rrhh_postulantes->pos_maximo_niv_formacion->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_maximo_niv_formacion->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_maximo_niv_formacion" class="control-group">
<select data-field="x_pos_maximo_niv_formacion" id="x_pos_maximo_niv_formacion" name="x_pos_maximo_niv_formacion"<?php echo $rrhh_postulantes->pos_maximo_niv_formacion->EditAttributes() ?>>
<?php
if (is_array($rrhh_postulantes->pos_maximo_niv_formacion->EditValue)) {
	$arwrk = $rrhh_postulantes->pos_maximo_niv_formacion->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($rrhh_postulantes->pos_maximo_niv_formacion->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $rrhh_postulantes->pos_maximo_niv_formacion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($rrhh_postulantes->pos_cv->Visible) { // pos_cv ?>
	<tr id="r_pos_cv">
		<td><span id="elh_rrhh_postulantes_pos_cv"><?php echo $rrhh_postulantes->pos_cv->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $rrhh_postulantes->pos_cv->CellAttributes() ?>>
<span id="el_rrhh_postulantes_pos_cv" class="control-group">
<span id="fd_x_pos_cv">
<span class="btn btn-small fileinput-button"<?php if ($rrhh_postulantes->pos_cv->ReadOnly || $rrhh_postulantes->pos_cv->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_pos_cv" name="x_pos_cv" id="x_pos_cv">
</span>
<input type="hidden" name="fn_x_pos_cv" id= "fn_x_pos_cv" value="<?php echo $rrhh_postulantes->pos_cv->Upload->FileName ?>">
<input type="hidden" name="fa_x_pos_cv" id= "fa_x_pos_cv" value="0">
<input type="hidden" name="fs_x_pos_cv" id= "fs_x_pos_cv" value="150">
</span>
<table id="ft_x_pos_cv" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $rrhh_postulantes->pos_cv->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("AddBtn") ?></button>
</form>
<script type="text/javascript">
frrhh_postulantesadd.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$rrhh_postulantes_add->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$rrhh_postulantes_add->Page_Terminate();
?>
